//
//  GetBackView.m
//  projectOfTeamSample
//
//  Created by lanou3g on 15/11/21.
//  Copyright © 2015年 liukai. All rights reserved.
//

#import "GetBackView.h"

@interface GetBackView ()

@property (nonatomic,strong)UILabel *getLable;
@property (nonatomic,strong)UILabel *phoneLable;
@property (nonatomic,strong)UILabel *NewLable;
@end

@implementation GetBackView

//初始化
-(id)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setSubViews];
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

//初始化的内容
-(void)setSubViews{
    CGRect fram = [UIScreen mainScreen].bounds;
    
    self.getLable = [[UILabel alloc]initWithFrame:CGRectMake(fram.origin.x +50, fram.origin.y + 200, 120, 30)];
    self.getLable.textColor = [UIColor blackColor];
    self.getText = [[UITextField alloc]initWithFrame:CGRectMake(fram.origin.x +180, fram.origin.y + 200, fram.size.width / 2, 30)];
    self.getText.layer.borderColor = [UIColor darkGrayColor].CGColor;
    self.getText.layer.masksToBounds = YES;
    self.getText.borderStyle = UITextBorderStyleRoundedRect;
    self.getText.layer.cornerRadius = 5;
    self.getText.layer.borderWidth = 1;
    
    self.getButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.getButton.frame = CGRectMake((fram.size.width /2) - (fram.size.width / 8), self.getText.frame.origin.y +50, fram.size.width / 4, fram.size.width / 4);
    
    
    [self addSubview:self.getText];
    [self addSubview:self.getLable];
    [self addSubview:self.getButton];
    
    
    [self getSource];
}

//设置
-(void)getSource{
    [self.getButton setBackgroundImage:[UIImage imageNamed:@"get"] forState:(UIControlStateNormal)];
    self.getLable.text = @"邮箱/手机号:";
    self.getText.placeholder = @"请输入邮箱/手机号";
    self.getText.layer.borderColor = [UIColor darkGrayColor].CGColor;
    self.getText.layer.cornerRadius = 5;
    self.getText.layer.masksToBounds = YES;
    self.getText.borderStyle = UITextBorderStyleRoundedRect;
}

//如果验证的是手机号,则要显示的内容的布局
-(void)setGetWithPhone{
    
     CGRect fram = [UIScreen mainScreen].bounds;
//phoneLable
    self.phoneLable = [[UILabel alloc]initWithFrame:CGRectMake(fram.origin.x +50, fram.origin.y + 300 + 90, 60, 30)];
    self.phoneLable.textColor = [UIColor blackColor];
    
//newlable
    self.NewLable = [[UILabel alloc]initWithFrame:CGRectMake(fram.origin.x +50, fram.origin.y + 350 + 90, 60, 30)];
    self.NewLable.textColor = [UIColor blackColor];
    
//    phoneTextField
    self.phoneText = [[UITextField alloc]initWithFrame:CGRectMake(fram.origin.x +120, fram.origin.y + 300 + fram.size.width / 4, fram.size.width / 2, 30)];
    self.phoneText.layer.borderColor = [UIColor darkGrayColor].CGColor;
    self.phoneText.layer.masksToBounds = YES;
    self.phoneText.borderStyle = UITextBorderStyleRoundedRect;
    self.phoneText.layer.cornerRadius = 5;
    self.phoneText.layer.borderWidth = 1;
    
//    phoneNewPasswordText
    self.phoneNewPasswordText = [[UITextField alloc]initWithFrame:CGRectMake(fram.origin.x +120, fram.origin.y + 350 + fram.size.width / 4, fram.size.width / 2, 30)];
    self.phoneNewPasswordText.layer.borderColor = [UIColor darkGrayColor].CGColor;
    self.phoneNewPasswordText.layer.masksToBounds = YES;
    self.phoneNewPasswordText.borderStyle = UITextBorderStyleRoundedRect;
    self.phoneNewPasswordText.layer.cornerRadius = 5;
    self.phoneNewPasswordText.layer.borderWidth = 1;
    
//   phoneButton
    self.phoneButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.phoneButton.frame = CGRectMake((fram.size.width /2) - (fram.size.width / 8), self.phoneText.frame.origin.y + fram.size.width / 8, fram.size.width / 4, fram.size.width / 4);
    
    
    [self addSubview:self.phoneText];
    [self addSubview:self.phoneLable];
    [self addSubview:self.phoneButton];
    [self addSubview:self.phoneNewPasswordText];
    [self addSubview:self.NewLable];
    [self phone];
}

//如果验证的是手机号,则要显示的内容
-(void)phone{
    self.phoneLable.text = @"验证码";
    self.NewLable.text = @"新密码";
    self.phoneText.placeholder = @"请输入验证码";
    self.phoneNewPasswordText.placeholder = @"请输入新密码";
    [self.phoneButton setBackgroundImage:[UIImage imageNamed:@"send"] forState:(UIControlStateNormal)];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
